package com.caigou.controller;

import com.caigou.bean.cms.param.AdListParam;
import com.caigou.bean.exam.entity.Users;
import com.caigou.security.utils.CurrentUser;
import com.caigou.service.AdListService;
import com.caigou.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api("广告管理器")
@RestController
@RequestMapping("/adList/")
public class AdListController {

    @Resource
    private AdListService adListService;

    @ApiOperation("根据广告位获取历史广告数据")
    @RequestMapping("loadAdListHistory")
    public Result loadAdListHistory(@RequestBody AdListParam param, @CurrentUser Users users){
       return adListService.loadAdListHistory(param);
    }

    @ApiOperation("恢复历史广告")
    @RequestMapping("recoverAdListHistory")
    public Result recoverAdListHistory(@RequestBody AdListParam param, @CurrentUser Users users){
        return adListService.recoverAdListHistory(param,users);
    }

    @ApiOperation("获取可同步广告位列表")
    @RequestMapping("loadSyncAdConfigList")
    public Result loadSyncAdConfigList(@RequestBody AdListParam param, @CurrentUser Users users){
        return adListService.loadSyncAdConfigList(param,users);
    }

    @ApiOperation("更换广告位的广告")
    @RequestMapping("updateAdListByConfig")
    public Result updateAdListByConfig(@RequestBody AdListParam param, @CurrentUser Users users){
        return adListService.updateAdListByConfig(param,users);
    }
}
